@layout("/common/_container.html"){
<link href="${ctxPath}/static/css/doctor/rootCanalScore.css" rel="stylesheet">
<div id="rootCanalScore">
    <input type="hidden" id="num" value="${num}">
    <input type="hidden" id="userName" value="${userName}">
    <input type="hidden" id="reservationsId" value="${reservationsId}">
    <div id="rootCanal_Header">小牙片</div>
    <div id="infoListTitle" style="position: absolute;top: 60%;left: 50%;transform: translate(-50%,-50%);"></div>
    <div id="rootCanal_Content">
            <div style="display: flex">
                @for(info in infoList){
                <div  class="cp_img imagePathBox">
                    <a href="javascript:void(0)" data-magnify="gallery" data-group="g1" data-src="${info.imageUrl}">
                        <img  src="${info.imageUrl}" alt="..." style="width: 100%;height: 110px;">
                    </a>
                    <div >
                        <label><input type="radio" name="radio" data-aa="${info.imageUrl}" checked="checked" value="${info.id}"></label>
                    </div>
                </div>
                @}
            </div>
    </div>
    <div >
        <button id="hideID" class="btn btn-default" type="button" onclick="submint()">提交</button>
        <button class="btn btn-default" type="button" onclick="yaClose()">关闭</button>
    </div>
</div>
<script>
    $(function () {
        var infoList = "${infoList}";
        if(infoList == "[]"){
            infoList = JSON.parse(infoList);
            if(infoList.length <= 0){
                var img = '<div><img src="https://pynnn.oss-cn-hangzhou.aliyuncs.com/noRecord.png" alt=""></div>';
                $("#infoListTitle").html(img);
                $("#hideID").hide();
            }
        }
    });
    submint = function () {
        var num = $("#num").val();
        var reservationsId = $("#reservationsId").val();
        var imageId = $('input[name="radio"]:checked').val();
        var imageUrl=  $('input[name="radio"]:checked').data("aa");
        var nur = reservationsId+","+num
        $.ajax({
            type: "POST",
            url: Feng.ctxPath + "/doctorLooked/saveYapian",
            data: {
                "num":num,
                "reservationsId":reservationsId,
                "imageId":imageId,
                "imageUrl":imageUrl
            },
            dataType: "json",
            success: function (data) {
                if(data==0){
                    alert("该小牙片已经上传了")
                }else{
                    var index = layer.open({
                        type: 2,
                        title: '根管上传',
                        area: ['90%', '95%'], //宽高
                        fix: true,
                        maxmin: true,
                        content: Feng.ctxPath + '/doctorLooked/dentalPlaque/' + nur
                    });
                    this.layerIndex = index
                }
            }
        });
    }
    yaClose = function () {
        parent.layer.close(parent.layer.getFrameIndex(window.name));
    };
</script>
@}